import pygame, sys, os, time, webbrowser
from pygame.locals import *

import gameengine

# jag ar inte saker pa namnet, men det kan vi ju andra sen. ps. aao gillas inte av python om man inte skriver ENCODING BLA BLA BLA langst upp :D
class GameController:
    def __init__(self, gameengine):
        self.ge = gameengine

    def input(self, events):
        for event in events:
            if event.type == QUIT:
                sys.exit(0)
            elif event.type == KEYDOWN:
                if event.key == K_ESCAPE:
                    sys.exit(0)
                if event.key == K_TAB:
                    webbrowser.open_new('http://code.google.com/p/negativespace/')
                else:
                    self.ge.eventKeyDown(event.key)
            elif event.type == KEYUP:
                self.ge.eventKeyUp(event.key)

    def update(self):
        self.input(pygame.event.get())
